Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guard against chance singularity in a sparse linalg test #25218

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Dec 21, 2017

Modify a sparse linalg test to guard against chance singularity causing test failure. Failure identified by @vtjnash in https://ci.appveyor.com/project/JuliaLang/julia/build/1.0.22640/job/prc1vdmu7xdix9r3. Best!

@Sacha0 Sacha0 added bugfix This change fixes an existing bug linear algebra Linear algebra test This change adds or pertains to unit tests labels Dec 21, 2017
@Sacha0 Sacha0 requested a review from andreasnoack December 21, 2017 03:56
@vtjnash
Copy link
Member

vtjnash commented Dec 21, 2017

@@ -1672,8 +1672,8 @@ end

@testset "sparse matrix cond" begin
local A = sparse(reshape([1.0], 1, 1))
Ac = sprandn(20, 20,.5) + im* sprandn(20, 20,.5)
Ar = sprandn(20, 20,.5)
Ac = Diagonal(fill(1., 20)) + (sprandn(20, 20,.5) + im*sprandn(20, 20,.5))/40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably make it too well condition. I did some simulations locally and

Ar = sprandn(20, 20,.5) + eps()*I

seems sufficient to avoid the singular case while still allowing for some variation in the condition number. It is not necessary to adjust the complex version since adding the two random patterns makes it extremely unlikely that the matrix is singular.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution also seems to take care of the issue reported in #25218 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised accordingly to worsen conditioning. (Not something I anticipated ever saying 😉.)

@andreasnoack andreasnoack merged commit 058716e into JuliaLang:master Dec 22, 2017
@Sacha0
Copy link
Member Author

Sacha0 commented Dec 23, 2017

Thanks all! :)

@Sacha0 Sacha0 deleted the evaporate branch December 23, 2017 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug linear algebra Linear algebra test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants